abidibo.net

react-native-location-manager

geolocation react-native react-native-location-manager

Managing location related tasks inside a react-native project can be quite frustrating. I've encountered many problems, for example when getCurrentPosition was always returning me a cached position object, despite of my configurations. For this reason I wrote a getLocation function that tries to incapsulate all the code needed to get a reliable position with a fallback to low accuracy mode.

But getting the real location is only a part of the story, which consists of many other tasks:

  • authorize the app to access location
  • enable location setting if disabled
  • inform the user about what it's going on
  • ...

So I finally decide to wrote a reusable component which tries to manage all this stuff in one place, which makes use of a redux reducer to manage its state and make it available to other components.

react-native-location-manager

It is quite a young package, first released on 27 november 2017, v0.1.0. It was tested with andorid simulator and one android device (xperia z3c), and seems to work as expected.

react-native-location-manager provides:

  • A redux connected component
  • A redux reducer
  • Two utility functions

Surf to the github repository page to read more about installation and getting started.

The LocationManager component works this way (click to enlarge)

What do you think? Ideas about how to improve such component will be much appreciated.

Subscribe to abidibo.net!

If you want to stay up to date with new contents published on this blog, then just enter your email address, and you will receive blog updates! You can set you preferences and decide to receive emails only when articles are posted regarding a precise topic.

I promise, you'll never receive spam or advertising of any kind from this subscription, just content updates.

Subscribe to this blog

Comments are welcome!

blog comments powered by Disqus

Your Smartwatch Loves Tasker!

Your Smartwatch Loves Tasker!

Now available for purchase!

Featured